From 68e50d20a7f765b3b5c6196f0d4de134fc111bac Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 14 Sep 2015 15:05:37 +0200 Subject: [PATCH] widget: Call size_allocate vfunc directly when possible This avoids all the overhead of signal emissions when it is not used. --- gtk/gtkwidget.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 4206c40682..7a05785aef 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -5969,7 +5969,10 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget, goto out; priv->allocated_baseline = baseline; - g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation); + if (g_signal_has_handler_pending (widget, widget_signals[SIZE_ALLOCATE], 0, FALSE)) + g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation); + else + GTK_WIDGET_GET_CLASS (widget)->size_allocate (widget, &real_allocation); /* Size allocation is god... after consulting god, no further requests or allocations are needed */ priv->alloc_needed = FALSE; -- 2.30.2